package main

func findMedianSortedArrays(nums1 []int, nums2 []int) float64 {
	nums := append(nums1, nums2...)
	length := len(nums)
	for {
		getOut := true
		for i := 0; i < length-1; i++ {
			if nums[i] > nums[i+1] {
				getOut = false
				nums[i], nums[i+1] = nums[i+1], nums[i]
			}
		}
		if getOut {
			break
		}
	}
	mid := len(nums) / 2
	if length%2 == 0 {
		return (float64(nums[mid-1]) + float64(nums[mid])) / 2
	} else {
		return float64(nums[mid])
	}
}
